package problems;

import lib.Fraction;

public class Euler071 extends AbstractEuler {

	@Override
	public Number calculate() {
		int largestMultipleOfSevenBelowOneMillion = 1000000/7; //142857

		Fraction threeSevenths = new Fraction(3,7);

		//calculate that 3/7 == 428571/999999, then subtract one to find the next closest one
		return threeSevenths.times(
			new Fraction(
				largestMultipleOfSevenBelowOneMillion,
				largestMultipleOfSevenBelowOneMillion
			)
		).getNumerator().intValue() - 1;

	}

	@Override
	protected Number getCorrectAnswer() {
		return 428570;
	}

}
